package org.birrap.entities;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

@Embeddable
public class BaresUsuarioTPK implements Serializable {
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID_BAR")
    private int idBar;
    
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 30)
    @Column(name = "CORREO")
    private String correo;

    public BaresUsuarioTPK() {
    }

    public BaresUsuarioTPK(int idBar, String correo) {
        this.idBar = idBar;
        this.correo = correo;
    }

    public int getIdBar() {
        return idBar;
    }

    public void setIdBar(int idBar) {
        this.idBar = idBar;
    }

    public String getCorreo() {
        return correo;
    }

    public void setCorreo(String correo) {
        this.correo = correo;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (int) idBar;
        hash += (correo != null ? correo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof BaresUsuarioTPK)) {
            return false;
        }
        BaresUsuarioTPK other = (BaresUsuarioTPK) object;
        if (this.idBar != other.idBar) {
            return false;
        }
        if ((this.correo == null && other.correo != null) || (this.correo != null && !this.correo.equals(other.correo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "org.birrap.entities.BaresUsuarioTPK[ idBar=" + idBar + ", correo=" + correo + " ]";
    }
    
}
